<template>
	<view class="">
		<fa-navbar title=" " :border-bottom="false"></fa-navbar>
		<view class="bg"></view>
		<image :src="sucai['index_search']" mode="widthFix" style="width: 100%;"></image>
		<!-- 	<u-navbar :is-back="false" title="首页" title-color="#fff" :background="background" :border-bottom="false"
			:is-fixed="false"> </u-navbar> -->
		<!-- 		<view class="" style="padding: 24rpx;position: relative;">
			<u-search placeholder="今日新品搭配" :show-action="false" bg-color="#fff" border-color="#7487FF"
				:clearabled="false" v-model="keyword" search-icon="scan"></u-search>
			<u-icon name="camera" size="36" color="#9a9a9a"
				style="position: absolute;right: 80rpx;top: 40rpx;z-index:99999;"></u-icon>
		</view> -->
		<view class="top_btn_group">
			<view class="top_btn_item" @click="goPage('/pages/index/newIndex?status=1', true)">
				<image :src="banar[0]" mode="widthFix" class="index_top_icon"></image>
				<view class="top_title">
					破土设计
				</view>
				<view class="top_name">
					(设计商城)
				</view>
			</view>
			<!-- pages/index/index  -->
			<!-- sub_pages/myPublish/myPublish -->
			<view class="top_btn_item" @click="goPage('/pages/index/index', true)">
				<image :src="banar[1]" mode="widthFix" class="index_top_icon"></image>
				<view class="top_title">
					破土森林
				</view>
				<view class="top_name">
					(美学社区)
				</view>
			</view>
			<view class="top_btn_item">
				<image :src="banar[2]" mode="widthFix" class="index_top_icon"></image>
				<view class="top_title">
					破土计划
				</view>
				<view class="top_name">
					(公益与教育)
				</view>
			</view>
		</view>

		<!-- 	<view class="" style="padding: 24rpx;">
			<image src="/static/image/second_icon1.png" mode="widthFix" class="index_img1"></image>
		</view> -->

		<!-- 轮播图根据单独接口 -->
		<view class="">
			<!-- <u-swiper height="1000" :list="list"></u-swiper> -->
			<u-swiper :effect3d="false" :title="false" :height="350" @click="openPage"
				:list="vuex_config.swiper_ptjh"></u-swiper>
		</view>


		<!-- 破土课程 -->
		<view class="img_group" style="">
			<view class="img_item" style="width: 48%;">
				<image :src="sucai['ptjh_sucai1']" mode="widthFix" class="index_img2" @click="toInfoDetail(1)"></image>
			</view>
			<view class="img_item" style="width: 60%;">
				<!-- 破土图书馆 -->
				<image :src="sucai['ptjh_sucai2']" mode="widthFix" class="index_img3" @click="toInfoDetail(2)">
				</image>
				<!-- 小学 -->
				<image :src="sucai['ptjh_sucai3']" mode="widthFix" class="index_img3" @click="toInfoDetail(3)"></image>
			</view>
		</view>
		<view style="position: relative;">
			<image src="@/static/image/second_index_img.jpg" mode="widthFix" style="width: 100%;"></image>
			<view class="btn_1" @click="todetail"></view>
			<view class="btn_2" @click="todetailBtn2"></view>
			<view class="btn_3" @click="todetailBtn3"></view>
		</view>
		<view style="height: 200rpx;"></view>
		<!-- <fa-tabbar></fa-tabbar> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',

				background: {
					backgroundColor: "transparent",
				},
				banar: [],
				list: [],
				sucai: [],
				cate: [],
				ptjh_sucai: [],
				article:[]
			}
		},
		onLoad() {
			// this.handleLoad()
			this.getVideo()
			// this.getGoodsIndex();
			// this.getpublicArticleList();

		},

		onShow() {

		},
		created() {

		},
		onReachBottom(e) {

		},
		methods: {
			getVideo() {
				this.$api.indexShow({}).then(res => {
					console.log(res)
					if (res.code == 1) {
						// this.indexvideo = res.data.indexvideo
						// this.haibao1 = res.data.haibao1
						this.banar = res.data.banar
						this.cate = res.data.catelist;
						this.sucai = res.data.sucai;
						this.ptjh_sucai = res.data.ptjh_sucai;
						this.article=res.data.article;
					}
				})
			},

			getpublicArticleList() {
				this.$api.getpublicArticleList().then(({
					code,
					data: res,
					msg
				}) => {
					if (code) {
						this.list = res.data;
						console.log(111, this.list);
						let length = this.list.length;
						// this.waterList = this.groupCut(this.list, length / 2)
						// this.hots = res.hots;
						// this.recommends = res.recommends;
					}
				});
			},



			grids(e) {
				let path = e.path;
				if (path == '/' || !path) {
					return;
				}
				if (path.substr(0, 1) == 'p') {
					path = '/' + path;
				}
				if (path.includes('http')) {
					this.$u.vuex('vuex_webs', {
						path: e.path,
						title: e.name
					});
					this.$u.route('/pages/webview/webview');
					return;
				}
				this.$u.route(path);
			},
			openPage(index) {
				console.log("跳转，，，，");
				this.grids({
					path: this.vuex_config.swiper[index].url,
					name: this.vuex_config.swiper[index].title
				});
			},
			click(index) {
				if (this.vuex_config.notice) {
					let url = this.vuex_config.notice[index].path;
					if (url) {
						this.grids({
							path: url,
							name: this.vuex_config.notice[index].title
						});
					}
				}
			},


			// swiperClick(e) {
			// 	console.log(e)
			// 	uni.navigateTo({
			// 		url: '/sub_pages/newDetail/newDetail'
			// 	})
			// },
			toInfoDetail(e) {
				uni.navigateTo({
					url: '/sub_pages/infoDetail/infoDetail?type=' + e
				})
			},
			todetail() {
				uni.navigateTo({
					url: '/sub_pages/donation/donation?type=1'
				})
			},
			todetailBtn2() {
				uni.navigateTo({
					url: '/sub_pages/donation/donation?type=2'
				}) 
			},
			todetailBtn3() {
				let gywmarticle=this.article['gygs'];
				console.log("sdfsdf",gywmarticle);
				uni.navigateTo({
					url: '/sub_pages/story/story?article='+gywmarticle
				})
			}


		},
	}
</script>
<style lang="scss">
	page {
		background-color: #f7faeb;
	}
</style>

<style lang="less" scoped>
	.top_btn_group {
		display: flex;
		align-items: flex-end;

		.top_btn_item {
			width: 33.33%;
			text-align: center;

			.index_top_icon {
				width: 196rpx;
			}

			.top_title {
				font-weight: 400;
				font-size: 32rpx;
				color: #529030;
				line-height: 44rpx;
				text-align: center;
				font-style: normal;
				text-transform: none
			}

			.top_name {
				font-weight: 600;
				font-size: 16rpx;
				color: rgba(51, 51, 51, 0.4);
				line-height: 44rpx;
				text-align: center;
				font-style: normal;
				text-transform: none;
			}
		}
	}

	.index_img1 {
		width: 100%;
		border-radius: 20rpx;
	}

	.img_group {
		display: flex;
		padding: 24rpx;

		.img_item {
			width: 50%;
			margin: 0 10rpx;
		}

		.index_img2 {
			width: 100%;
			height: 540rpx;
			border-radius: 14rpx;
		}

		.index_img3 {
			width: 100%;
			height: 48%;
			border-radius: 14rpx;
			// margin: 20rpx;
		}
	}


	.btn_group {
		padding: 24rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.btn_item {
			width: 33.33%;
			text-align: center;

			.btn_title {
				background-color: #649142;
				border-radius: 50%;
				padding: 20rpx;
				color: #fff;
				font-size: 40rpx;
				font-weight: bold;
				margin: 10rpx;
			}
		}
	}

	.btn_1 {
		width: 120rpx;
		height: 120rpx;
		background-color: transparent;
		position: absolute;
		left: 110rpx;
		top: 120rpx;
		z-index: 1;
	}

	.btn_2 {
		width: 120rpx;
		height: 120rpx;
		background-color: transparent;
		position: absolute;
		left: 312rpx;
		top: 120rpx;
		z-index: 1;
	}

	.btn_3 {
		width: 120rpx;
		height: 120rpx;
		background-color: transparent;
		position: absolute;
		right: 110rpx;
		top: 120rpx;
		z-index: 1;
	}
</style>